<?php

namespace App\Http\Controllers;

use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;

class ShopController extends Controller
{

    public function result($msg,$data,$code)
    {
        return new JsonResponse(['msg' => $msg,'data' => $data,'code' => $code]);
    }

    public function success($msg = '操作成功',$data = null,$code = 1)
    {
        return $this->result($msg,$data,$code);
    }

    public function error($msg = '操作失败',$data = null,$code = 0)
    {
        return $this->result($msg,$data,$code);
    }

}
